//
// Created by mi on 2024/2/3.
//
#include <iostream>
#include "gtest/gtest.h"

using namespace std;

bool is_prime(int num) {
    if (num < 2)
        return false;
    for (int i = 2; i <= sqrt(num) + 1; i++) {
        if (num % i == 0)
            return false;
    }
    return true;
}

TEST(test_prime, is_true) {
    EXPECT_TRUE(is_prime(5));
    ASSERT_TRUE(is_prime(5));
    EXPECT_TRUE(is_prime(3));
}

TEST(test_prime, is_false) {
    ASSERT_FALSE(is_prime(4));
    EXPECT_FALSE(is_prime(4));
}

class A {
public:
    explicit A(const char *p) {
        if (p && strlen(p) > 0) {
            data = new char[strlen(p) + 1];
            strncpy_s(data, strlen(p) + 1, p, strlen(p) + 1);
        }
    }

    ~ A() {
        if (data) {
            delete[] data;
        }
    }

private:
    char *data;
};

int main(int argc, char *argv[]) {
    //testing::InitGoogleTest(&argc, argv);
    //RUN_ALL_TESTS();
    A a("hello");
   // A b = a;
    return 0;
}